/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yufei.toolinterface;

import java.awt.Dimension;







import java.awt.Toolkit;

import javax.swing.JDialog;
import javax.swing.JFrame;

import com.yufei.toolinterface.util.DialogUtil;

/**
 *
 * @author Administrator
 */
public class MainFrame extends javax.swing.JFrame {

    /**
     * Creates new form MainFrame
     */
    public MainFrame() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        convertCharacaterButton = new javax.swing.JButton();
        addTaskButton = new javax.swing.JButton();
        infoSearchButton = new javax.swing.JButton();
        regexTestButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        convertCharacaterButton.setText("转换特殊字符");
        convertCharacaterButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                convertCharacaterButtonActionPerformed(evt);
            }
        });

        addTaskButton.setText("更新Task信息");
        addTaskButton.setToolTipText("将XML文档中的task信息全部保存到数据库中，如果数据库中已有，则先删除后保存，没有直接保存");
        addTaskButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addTaskButtonActionPerformed(evt);
            }
        });

        infoSearchButton.setText("采集信息查询");
        infoSearchButton.setToolTipText("根据用户输入的查询条件返回符合条件的结果列表");
        infoSearchButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                infoSearchButtonActionPerformed(evt);
            }
        });

        regexTestButton.setText("正则表达式验证");
        regexTestButton.setToolTipText("用于测试某个url对应网页内容的正则表达式的正确性");
        regexTestButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                regexTestButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(convertCharacaterButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(addTaskButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(infoSearchButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(regexTestButton)
                .addGap(0, 262, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(convertCharacaterButton)
                    .addComponent(addTaskButton)
                    .addComponent(infoSearchButton)
                    .addComponent(regexTestButton))
                .addGap(0, 77, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(287, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void convertCharacaterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_convertCharacaterButtonActionPerformed
        // TODO add your handling code here:
        JDialog jpanel=new NewJDialog(null,false);
        jpanel.setLocationRelativeTo(this);
        jpanel.pack();
        jpanel.setVisible(true);
       
    }//GEN-LAST:event_convertCharacaterButtonActionPerformed

    private void addTaskButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTaskButtonActionPerformed
        // TODO add your handling code here:
    	   JDialog jpanel=new AddTaskJDialog(null,false);
    	   
           jpanel.setLocationRelativeTo(this);
           jpanel.pack();
           jpanel.setVisible(true);
    }//GEN-LAST:event_addTaskButtonActionPerformed

    private void infoSearchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_infoSearchButtonActionPerformed
        // TODO add your handling code here:
    	   JDialog jpanel=new InfoSearch(null,false);
    	 //  DialogUtil.fullScreen(jpanel);
           jpanel.pack();
           jpanel.setVisible(true);
    }//GEN-LAST:event_infoSearchButtonActionPerformed

    private void regexTestButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_regexTestButtonActionPerformed
        // TODO add your handling code here:
         JDialog jpanel=new RegexTestDialog(null,false);
    	   
           jpanel.setLocationRelativeTo(this);
           jpanel.pack();
           jpanel.setVisible(true);
    }//GEN-LAST:event_regexTestButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        final  JFrame mainFrame=new MainFrame();
        mainFrame.setLocationRelativeTo(null);
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
               mainFrame.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton addTaskButton;
    private javax.swing.JButton convertCharacaterButton;
    private javax.swing.JButton infoSearchButton;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton regexTestButton;
    // End of variables declaration//GEN-END:variables
}
